package com.wx.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wx.pojo.Sort;
import com.wx.service.AssortmentService;

/**
 * 类别查询:像办公类、会员卡类等查询
 *
 */
@Controller
@RequestMapping("/assortment")
public class AssortmentController {
	
	@Autowired
	private AssortmentService assortmentService;
	
	
     /**
	 * 查询全部分类
	 * @return
	 */
	@RequestMapping("/findAssortment")
	@ResponseBody
	public Map<String,Object> findAssortment(){
		
		Map<String,Object> modelMap=new HashMap<String,Object>();
		//获取二级分类
		List<Sort> assortmentList=assortmentService.findAssortment();
		
		modelMap.put("assortmentList",assortmentList);
		return modelMap;
	}
	
	/**
	 * 查询一个大的分类：例如办公类，会员卡类
	 * @return
	 */
	
	@RequestMapping("/findSort")
	@ResponseBody
	public Map<String,Object> findSort(){
		Map<String,Object> modelMap=new HashMap<String,Object>();
		
		List<Sort>sortList=assortmentService.findSort();
		
		modelMap.put("sortList", sortList);
		return modelMap;
	}
	
	
	
	
}
